﻿using JVMTI_CONN_CONNECT;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;

namespace JVMTI_CORE_SHELL.Converters
{
    class DataContextToRelatedEventsConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value == null) return null;
            var vm = (ILifeEvent)value;
            return vm.GetRelatedEvents(((App.Current.MainWindow as MainWindow).lifeCycleView.ItemsSource as LifeCycleViewModels).SelectMany<LifeCycleViewModel, ILifeEvent>(e => e.KeyEvents));
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
